home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1995 June
/
MacFormat 25.iso
/
Shareware City
/
Developers
/
OutOfPhase1.1 Source
/
OutOfPhase Folder
/
SymbolList.c
< prev
next >
Wrap
Text File
|
1994-08-15
|
3KB
|
100 lines
/* SymbolList.c */
/*****************************************************************************/
/* */
/* Out Of Phase: Digital Music Synthesis on General Purpose Computers */
/* Copyright (C) 1994 Thomas R. Lawrence */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* */
/* Thomas R. Lawrence can be reached at tomlaw@world.std.com. */
/* */
/*****************************************************************************/
#include "MiscInfo.h"
#include "Audit.h"
#include "Debug.h"
#include "Definitions.h"
#include "SymbolList.h"
#include "TrashTracker.h"
#include "Memory.h"
struct SymbolListRec
{
struct SymbolRec* First;
SymbolListRec* Rest;
};
/* cons operation for a symbol list */
SymbolListRec* SymbolListCons(struct SymbolRec* First, SymbolListRec* Rest,
struct TrashTrackRec* TrashTracker)
{
SymbolListRec* NewConsCell;
if (First != NIL)
{
CheckPtrExistence(First);
}
if (Rest != NIL)
{
CheckPtrExistence(Rest);
}
NewConsCell = (SymbolListRec*)AllocTrackedBlock(sizeof(SymbolListRec),TrashTracker);
if (NewConsCell == NIL)
{
return NIL;
}
SetTag(NewConsCell,"SymbolListRec");
NewConsCell->First = First;
NewConsCell->Rest = Rest;
return NewConsCell;
}
/* get the first entry from the symbol list */
struct SymbolRec* GetFirstFromSymbolList(SymbolListRec* ListEntry)
{
CheckPtrExistence(ListEntry);
return ListEntry->First;
}
/* get the rest list from the symbol list */
SymbolListRec* GetRestListFromSymbolList(SymbolListRec* ListEntry)
{
CheckPtrExistence(ListEntry);
return ListEntry->Rest;
}
/* get the length of the symbol list */
long GetSymbolListLength(SymbolListRec* ListEntry)
{
if (ListEntry == NIL)
{
return 0;
}
else
{
CheckPtrExistence(ListEntry);
return 1 + GetSymbolListLength(ListEntry->Rest);
}
}